package cn.piggy.gateway.core.proxy.cglib;

import cn.piggy.gateway.core.proxy.MethodIntercept;
import cn.piggy.gateway.core.session.GatewaySession;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;
import java.lang.reflect.Method;
import java.util.Map;


public class MapperProxy implements MethodInterceptor {

    private GatewaySession gatewaySession;


    public MapperProxy(GatewaySession gatewaySession) {
        this.gatewaySession = gatewaySession;
    }

    @Override
    public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) {
        MethodIntercept linkMethod = new MethodIntercept(gatewaySession, (Map<String, Object>) args[0]);
//        Future<Object> queue = linkMethod.queue();
        return linkMethod.execute();
    }

}